package com.jgc.stage01.interrupt;

/**
 * Created by Administrator on 2022/2/10.
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        //isInterrupted（）方法作用是只测试此线程是否被中断 ，不清除中断状态
        //interrupted
        //调用interrupt（）方法后，线程仍在继续运行，并未停止，但已经给线程设置了中断标志，
        // 两个isInterrupted（）方法都会输出true，也说明isInterrupted（）方法并不会清除中断状态
        MyThread thread=new MyThread();
        thread.start();
        thread.interrupt();
        System.out.println("第一次调用thread.isInterrupted()："+thread.isInterrupted());
        System.out.println("第二次调用thread.isInterrupted()："+thread.isInterrupted());
        System.out.println("thread是否存活："+thread.isAlive());
    }
}
